#ifndef _thread_thread_h
#define _thread_thread_h

#include <pthread.h>
#include "Mutex.h"
#include "Condition.h"
#include "Task.h"

namespace ddserver
{
namespace thread
{

class Thread
{
public:
    Thread();
    virtual ~Thread();

public:
    virtual void run() = 0;

public:
    void start();
    void stop();
    void set_task(Task* task);
    Task* get_task();

protected:
    static void* thread_func(void* ptr);

protected:
    pthread_t m_tid;
    Task* m_task;
    Mutex m_mutex;
    Condition m_cond;
};

}
}
#endif